#ifndef UTIL_H

#define UTIL_H


#define read_request 1

#include "dataDef.h"

unsigned short CRC_16 (unsigned short CRC, unsigned short Cod);

unsigned short calculateMBcrc (mbPacket packet, int type);

unsigned char * serializeMBpacket(mbPacket packet, unsigned char * buffer);

mbPacket deserializeMBpacket(unsigned char * buffer);

void reverseWord(sWord * a);

int validateData(unsigned char * buffer);

int receiveData(unsigned char * buffer, int len);

int expectedLenght(mbPacket packet,int type);

#endif
